package remote

import (
	"context"
	"errors"
	"log"
	"xiuxian_help_tool/backend/model/res"
	"xiuxian_help_tool/backend/utils/sdk"
	xiuXianba "xiuxian_help_tool/backend/utils/sdk/xiuxianba"
)

type AgentService struct {
}

var AgentServiceApp = new(AgentService)

// GetAgentSelectList 获取服务商列表
func (*AgentService) GetAgentSelectList() (*res.AgentSelectListResp, error) {
	ctx := context.Background()
	var resp *sdk.APIRes[*res.AgentSelectListResp]
	err := xiuXianba.XiuXianCli.Post("/backend/api/v1/agent/select").
		SetBody(res.AgentSelectListReq{}).
		Do(ctx).Into(&resp)
	if err != nil {
		log.Println("获取服务商列表失败", err)
		return nil, err
	}
	if resp != nil && resp.Code == 0 {
		return nil, errors.New("获取服务商列表失败")
	}
	return resp.Data, nil
}
